import Vue from 'vue'
import VueI18n from 'vue-i18n'
import App from './App.vue'
import router from './router'
import store from './store'
import enUS from './locale/enUS'
import zhCN from './locale/zhCN'

import {
  Button,
  Layout,
  Menu,
  Icon,
  Breadcrumb,
  Drawer,
  Radio,
  Form,
  Input,
  Select,
  LocaleProvider,
  Dropdown,
  ConfigProvider,
  DatePicker
} from 'ant-design-vue'
import Authorized from './components/Authorized'
import Auth from './directives/auth'
import queryString from 'query-string'

Vue.config.productionTip = false

Vue.use(Button)
Vue.use(Layout)
Vue.use(Menu)
Vue.use(Icon)
Vue.use(Breadcrumb)
Vue.use(Drawer)
Vue.use(Radio)
Vue.use(Form)
Vue.use(Input)
Vue.use(Select)
Vue.use(LocaleProvider)
Vue.use(Dropdown)
Vue.use(ConfigProvider)
Vue.use(DatePicker)
Vue.component('Authorized', Authorized)
Vue.use(Auth)
Vue.use(VueI18n)

const i18n = new VueI18n({
  locale: queryString.parse(location.search).locale || 'zhCN',
  messages: {
    zhCN: { message: zhCN },
    enUS: { message: enUS }
  }
})

const IconFont = Icon.createFromIconfontCN({
  scriptUrl: '//at.alicdn.com/t/font_2957792_wl6m7g3a2rb.js' // generated by iconfont.cn
})

Vue.component('IconFont', IconFont)

new Vue({
  i18n,
  router,
  store,
  render: h => h(App)
}).$mount('#app')
